<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-wPay-edit" th:object="${wPay}">
            <input id="payId" name="payId" th:field="*{payId}"  type="hidden">

			<div class="form-group">	
				<label class="col-sm-3 control-label">支付单号：</label>
				<div class="col-sm-8">
					<input id="payNo" name="payNo" th:field="*{payNo}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">支付方式：</label>
				<div class="col-sm-8">
					<input id="payType" name="payType" th:field="*{payType}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">订单ID：</label>
				<div class="col-sm-8">
					<input id="orderId" name="orderId" th:field="*{orderId}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">支付状态：</label>
				<div class="col-sm-8">
					<input id="state" name="state" th:field="*{state}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<input id="remark" name="remark" th:field="*{remark}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">状态：</label>
				<div class="col-sm-8">
					<div class="onoffswitch">
						<input type="checkbox" th:checked="${wPay.status == '0' ? true : false}" class="onoffswitch-checkbox" id="status" name="status">
						<label class="onoffswitch-label" for="status">
							<span class="onoffswitch-inner"></span>
							<span class="onoffswitch-switch"></span>
						</label>
					</div>
				</div>
			</div>

		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "foxwash/wPay";
		$("#form-wPay-edit").validate({
			rules:{
				xxxx:{
					required:true,
				},
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            //$.operate.save(prefix + "/edit", $('#form-wPay-edit').serialize());
				edit();
	        }
	    }
        function edit() {
            var payId = $("input[name='payId']").val();
            var payNo = $("input[name='payNo']").val();
            var payType = $("input[name='payType']").val();
            var orderId = $("input[name='orderId']").val();
            var state = $("input[name='state']").val();
            var remark = $("input[name='remark']").val();
            var status = $("input[name='status']").is(':checked') == true ? 0 : 1;
            $.ajax({
                cache : true,
                type : "POST",
                url : prefix + "/edit",
                data : {
                    "payId": payId,
                    "payNo": payNo,
                    "payType": payType,
                    "orderId": orderId,
                    "state": state,
                    "remark": remark,
                    "status": status
                },
                async : false,
                error : function(request) {
                    $.modal.alertError("系统错误");
                },
                success : function(data) {
                    $.operate.successCallback(data);
                }
            });
        }
	</script>
</body>
</html>
